﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace Fireball.Syntax.Parser
{
    public class BracketCollection : ObservableCollection<Bracket>
    {
        public bool IsBracket(char bracket, out BracketType type)
        {
            foreach (var c in this)
            {
                if (c.Start == bracket)
                {
                    type = BracketType.Start;
                    return true;
                }
                else if (c.End == bracket)
                {
                    type = BracketType.End;
                    return true;
                }
            }
            type = BracketType.None;
            return false;
        }
    }
}
